import {
  Entity,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
  PrimaryColumn
} from "typeorm";

/**
 * 小程序抽奖活动表
 */
@Entity("BBL_PRIZE_GROUP")
export class BblPrizeGroup {
  @PrimaryColumn({
    name: "ID",
    type: "varchar",
    length: 50,
    comment: "活动ID"
  })
  id: string;

  @Column({
    name: "NAME",
    type: "varchar",
    length: 50,
    nullable: false,
    comment: "活动名称"
  })
  name: string;

  @Column({
    name: "STATUS",
    type: "tinyint",
    default: 0,
    nullable: false,
    comment: "活动状态(0=未开始,1=进行中,2=已结束,3=已取消)"
  })
  status: number;

  @Column({
    name: "START_TIME",
    type: "timestamp",
    precision: 6,
    nullable: true,
    comment: "开始时间"
  })
  startTime: Date;

  @Column({
    name: "END_TIME",
    type: "timestamp",
    precision: 6,
    nullable: true,
    comment: "结束时间"
  })
  endTime: Date;

  @Column({
    name: "DESCRIPTION",
    type: "text",
    nullable: true,
    comment: "活动描述"
  })
  description: string;

  @CreateDateColumn({
    name: "CREATED_AT",
    type: "timestamp",
    precision: 6,
    nullable: true,
    default: () => "CURRENT_TIMESTAMP(6)",
    comment: "创建时间"
  })
  createdAt: Date;

  @UpdateDateColumn({
    name: "UPDATED_AT",
    type: "timestamp",
    precision: 6,
    nullable: true,
    default: () => "CURRENT_TIMESTAMP(6)",
    onUpdate: "CURRENT_TIMESTAMP(6)",
    comment: "更新时间"
  })
  updatedAt: Date;

  @Column({
    name: "CREATED_BY",
    type: "varchar",
    length: 50,
    nullable: true,
    comment: "创建人ID"
  })
  creatorId: string;

  @Column({
    name: "UPDATED_BY",
    type: "varchar",
    length: 50,
    nullable: true,
    comment: "更新人ID"
  })
  updaterId: string;
}
